// AchievementMapper.java 新增方法
package com.ts.mapper.achievement;

import com.ts.entity.Achievement;
import com.ts.dto.AchievementPageDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;

import java.util.List;

@Mapper
public interface AchievementMapper {

    // 原有方法保持不变...
    @Insert("insert into `tianshi-college-teacher-system-test`.ts_achievement" +
            "(name, type, status, description," +
            " level, detail_id, created_by, updated_by," +
            "created_time, updated_time) values (" +
            "#{name}, #{type}, #{status}, #{description}, " +
            "#{level}, #{detailId}, #{createdBy}, #{updatedBy}, " +
            "#{createdTime}, #{updatedTime})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    void insert(Achievement achievement);

    void update(Achievement achievement);

    @Delete("delete from `tianshi-college-teacher-system-test`.ts_achievement where detail_id = #{detailId}")
    void deleteById(Long detailId);

    // 新增分页查询方法
    List<Achievement> selectByCondition(AchievementPageDTO dto);
}